#include "scriptstab.h"

ScriptsTab::ScriptsTab(QTableView* scriptview, QWidget *parent) :
    QWidget(parent),m_scriptsview(scriptview)
{
    QVBoxLayout* main_layout = new QVBoxLayout;
    QHBoxLayout* buttons_layout = new QHBoxLayout;

    QPushButton* new_button = new QPushButton("Create New");
    QPushButton* add_button = new QPushButton("Load");
    QPushButton* remove_button = new QPushButton("Remove");

    buttons_layout->addWidget(new_button);
    buttons_layout->addWidget(add_button);
    buttons_layout->addWidget(remove_button);

    main_layout->addLayout(buttons_layout);
    main_layout->addWidget(m_scriptsview);
    m_scriptsview->horizontalHeader()->setResizeMode(QHeaderView::Stretch);

    this->setLayout(main_layout);

    connect(new_button,SIGNAL(clicked()),this,SLOT(New()));
    connect(add_button,SIGNAL(clicked()),this,SLOT(Add()));
    connect(remove_button,SIGNAL(clicked()),this,SLOT(Delete()));
}

void ScriptsTab::New(){
    emit NewPressed();
}

void ScriptsTab::Add(){
    emit AddPressed();
}


void ScriptsTab::Delete(){
    emit DeletePressed();
}
